package com.shujia.flink.source;

import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;

public class Demo01ListSource {
    public static void main(String[] args) throws Exception {
        // 从本地集合构建DS：有界流，数据处理完后会结束任务，主要用于学习测试
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        ArrayList<String> arrList = new ArrayList<>();
        arrList.add("java");
        arrList.add("scala");
        arrList.add("python");

        DataStreamSource<String> listDS = env.fromCollection(arrList);

        listDS.keyBy(w->w, Types.STRING).print();

        env.execute();
    }
}
